package test.utils.depre.sakis;

import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.BitmapFont;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import com.megacrit.cardcrawl.cards.AbstractCard;
import com.megacrit.cardcrawl.core.Settings;
import com.megacrit.cardcrawl.helpers.FontHelper;
import test.utils.FontUtils;

import java.util.ArrayList;

import static mutsumimod.MutsumiMod.imagePath;

abstract public class Saki extends AbstractAnimation {

    public static ArrayList<Texture> images = new ArrayList<>();
    public float x;
    public float y;
    public static final float SAKI_WIDTH = 256f* Settings.scale;
    public static final float SAKI_HEIGHT = 256f*Settings.scale;
    public int movedDistance;
    public int canMoveDistance;

    public static final float FONT_OFFSET_X=80.0f*Settings.scale;
    public static final float FONT_OFFSET_Y=100.0f*Settings.scale;

    public static BitmapFont BANG_FONT=FontUtils.createNoShadowFont(32.0f);

    static {
        for (int i = 0; i < 8; i++) {
            images.add(new Texture(imagePath("ui/saki_ship/frame_00" + i + ".png")));
        }
    }

    public Saki(int movedDistance,int canMoveDistance){
        this();
        this.movedDistance = movedDistance;
        this.canMoveDistance = canMoveDistance;
    }

    public Saki() {
        super(images);
    }

    public void triggerOnDown(AbstractCard card){

    }

    @Override
    public void render(SpriteBatch sb) {
        if (currentImage != null) {
            sb.draw(currentImage,
                    x, y,
                    SAKI_WIDTH /2, SAKI_HEIGHT /2,
                    SAKI_WIDTH, SAKI_HEIGHT,
                    1f, 1f,
                    0f,
                    0, 0,
                    currentImage.getWidth(), currentImage.getHeight(),
                    false, false);

            FontHelper.renderFontCentered(sb, BANG_FONT, Integer.toString(canMoveDistance)
                    , x+FONT_OFFSET_X,y+FONT_OFFSET_Y, Color.BLACK.cpy() );
            FontHelper.renderFontLeft(sb, BANG_FONT, Integer.toString(movedDistance)
                    , x+ SAKI_WIDTH -FONT_OFFSET_X,y+FONT_OFFSET_Y , Color.BLACK.cpy() );
        }
    }

}
